package com.ytjj.qmyx.admin.dao.data;


import com.ytjj.qmyx.admin.model.data.response.ChannelCostMoneyResponse;
import com.ytjj.qmyx.admin.model.data.response.ChannelDateStatisticResponse;
import com.ytjj.qmyx.admin.model.data.response.ChannelStatisticResponse;
import com.ytjj.qmyx.admin.model.data.response.ChannelUserResponse;
import com.ytjj.qmyx.admin.model.request.dataStatistics.DataStatisticsRequest;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Repository
public interface PlatformStatisticDao {

    Integer getChannelOrderData(@Param("startTime") LocalDateTime startTime,
                                 @Param("endTime") LocalDateTime endTime,
                                 @Param("platform") String platform,
                                 @Param("channel") String channel,
                                 @Param("userAddress") String userAddress,
                                 @Param("isPay") Integer isPay,
                                 @Param("isFirstBuy") Integer isFirstBuy,
                                @Param("activityType") String activityType,
                                @Param("isRefund") Integer isRefund);

    BigDecimal getCostMoney(DataStatisticsRequest dataStatisticsRequest);

    BigDecimal getCostMoneyV2(@Param("order_source") String order_source,
                              @Param("startTime") LocalDateTime startTime,
                              @Param("endTime") LocalDateTime endTime,
                              @Param("channel") String channel);


    List<ChannelCostMoneyResponse> getCostMoneyV3(@Param("order_source") String order_source,
                                                  @Param("startTime") LocalDateTime startTime,
                                                  @Param("endTime") LocalDateTime endTime,
                                                  @Param("channelList") List<String> channelList);

    Integer getNewAddUser(DataStatisticsRequest dataStatisticsRequest);

    List<ChannelUserResponse> getAddUserV2(@Param("platform") String platform,
                                              @Param("startTime") LocalDateTime startTime,
                                              @Param("endTime") LocalDateTime endTime,
                                              @Param("channelList") List<String> channelList);


    Integer getActiveUser(DataStatisticsRequest dataStatisticsRequest);

    List<ChannelUserResponse> getActiveUserV2(@Param("platform") String platform,
                                             @Param("startTime") LocalDateTime startTime,
                                             @Param("endTime") LocalDateTime endTime,
                                             @Param("channelList") List<String> channelList);

    Integer getClickAddress(DataStatisticsRequest dataStatisticsRequest);

    BigDecimal getPayMoney(DataStatisticsRequest dataStatisticsRequest);

    BigDecimal getRefunMoney(DataStatisticsRequest dataStatisticsRequest);

    /**
     * 获取时间段内的所有下单的渠道
     */
    List<String> queryChannels(@Param("startTime") LocalDateTime startTime,
                               @Param("endTime") LocalDateTime endTime,
                               @Param("platform") String platform,
                               @Param("booleanFlag") Integer booleanFlag,
                               @Param("channelList") List<String> channelList);


    List<ChannelStatisticResponse> getNewOrderStatisticsList(@Param("order_source") String order_source,
                                                             @Param("startTime") LocalDateTime startTime,
                                                             @Param("endTime") LocalDateTime endTime,
                                                             @Param("channelList") List<String> channelList);

    List<ChannelDateStatisticResponse> getOrderCreateDateList(@Param("order_source") String order_source,
                                                              @Param("startTime") LocalDateTime startTime,
                                                              @Param("endTime") LocalDateTime endTime,
                                                              @Param("channelList") List<String> channelList);

    List<ChannelStatisticResponse> getPlatformDataV3(@Param("order_source") String order_source,
                                                             @Param("startTime") LocalDateTime startTime,
                                                             @Param("endTime") LocalDateTime endTime,
                                                             @Param("channelList") List<String> channelList);

}
